//counter to clean the screen on reaching max number of queries MAX_NB_QUERIES
var MAX_NB_QUERIES=5;
var nbQueries=0;

$(document).ready(function() {
    
    
    
    //1) builds the listbox contents: we feed the HTML elements from arListBoxElements as options for this listbox
    for (var i=0; i<arListBoxElements.length;i++) {        
        var linkOption=$("<option>")
        .val(i)
        .text(arListBoxElements[i]);
        
        if (i==selectedTestcaseId) {
            linkOption.attr("selected","selected");
        }
            
        $("#listBoxPlaceholder").append(linkOption);
        

    }
    
    //2) binds the actions to the events for the listbox
    for (eventName in arListBoxEventActions) {
        $("#listBoxPlaceholder").bind(eventName, arListBoxEventActions[eventName]);
    }
    
    
})

function displayFeedback(data) {
    nbQueries++;
    
    if (nbQueries >= MAX_NB_QUERIES) {
        //clean the console section
       $('#console').text("");
       nbQueries=0;
    }
    
    var currentDate=new Date();
    $('#console').append(currentDate.getHours()+":"+currentDate.getMinutes()+":"+currentDate.getSeconds()+"_"+data+"<br/>");
    

}
